/*
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2023-06-20 18:20:48
 * @LastEditors: wsh
 * @LastEditTime: 2023-06-25 10:35:57
 */
// 列表
import { uploadType } from '@/utils/util'
const tableConfig = {
  stripe: true,
  border: true,
  maxHeight: '80vh',
  columns: [
    { label: '身份证号', prop: 'idCard' },
    { label: '姓名', prop: 'name' },
    { label: '联系方式', prop: 'phone' },
    // { 
    //   label: '专职',
    //   type:"remoteSelect",
    //   prop: 'jobType',
    //   propName:'jobTypeLabel',
    //   api:"getDictItemList",
    //   code:"WORK_TYPE"
    // },
    { 
      label: '职业类型',
      prop: 'jobTypeLabel',
    },
    { label: '开始时间', prop: 'leaveStartDate' },
    { label: '结束时间', prop: 'leaveEndDate' },
    { label: '请假时长（天）', prop: 'leaveDuration' },
    { 
      label: '请假类型',
      prop: 'leaveTypeLabel',
     },
    { label: '备注', prop: 'note' },
    {
      label: '状态', 
      prop: 'status',
      custome: 'tag',
      dicData:[
        {label:"正常",value:0,type:"success"},
        {label:"已撤销",value:1,type:"danger"}
      ]
    },
    {
      label: '操作',
      prop: 'menu',
      width: 300,
      fixed: 'right'
    }
  ]
}
// 详情
export const detailConfig = {
  inline: false,
  showBtn: false,
  labelPosition: 'left',
  column: [
    { label: '身份证号', prop: 'idCard', span: 12},
    { label: '姓名', prop: 'name', span: 12},
    {   
      label: '请假类型',
      prop: 'leaveType',
      propName:'leaveTypeLabel',
      type:"remoteSelect",
      api:"getDictItemList",
      code:"LEAVEMANAGEMENT_LEAVE_TYPE" 
    },
    { label: '开始时间', prop: 'leaveStartDate', span:12 },
    { label: '结束时间', prop: 'leaveEndDate',span:12 },
    { label: '备注', prop: 'note', span: 12 },
    { 
      label: '说明附件',
      prop:'accessories',
      type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 4,
			multiple: true,
      span: 24 
    },
  ]
}

export const baseConfig = {
  pageName: '员工请假管理',
  // 数据字典
  dictcodes: [],
  rowKey: 'name',
  addLabel:'',
  api: {
    index: 'view_dpEmployeeLeaveRecord_page',
  },
  auth: {
    index: 'view_dpEmployeeLeaveRecord_page',
  },
  // 当前行操作按钮
  menuBtn: [
    {
      icon: 'detail',
      label: '详情',
      type: 'primary',
      operate: 'detail',
      auth: 'view_dpEmployeeLeaveRecord_page',
      text: true,
      show: true
    },
  ],
  dialogConfig: {
    width: '80%'
  },
  detailConfig,
  // 列表
  tableConfig,
  // 详情
  beforeOnLoadFormate: (query) => {
    return new Promise((resolve, reject) => {
      if (query.hasOwnProperty('leaveDateBetween')) {
        const values = Object.values(query.leaveDateBetween)
        query.leaveDateBetween = values.join(',')
      }
      resolve({
        ...query,
      })
    })
  },
}